package com.jiao.store.entity;

import lombok.Data;

import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

//实体类的基类
//@Data  //简化get/set
public class BaseEntity implements Serializable {
  //创建人
    private  String creatUser;
    //创建时间
    private Date creatTime;
    //修改人
    private  String modifiedUser;
    //修改时间
    private  Date modifiedTime;

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof BaseEntity)) return false;
    BaseEntity that = (BaseEntity) o;
    return getCreatUser().equals(that.getCreatUser()) && getCreatTime().equals(that.getCreatTime()) && getModifiedUser().equals(that.getModifiedUser()) && getModifiedTime().equals(that.getModifiedTime());
  }

  @Override
  public int hashCode() {
    return Objects.hash(getCreatUser(), getCreatTime(), getModifiedUser(), getModifiedTime());
  }

  public BaseEntity() {
  }

  public BaseEntity(String creatUser, Date creatTime, String modifiedUser, Date modifiedTime) {
    this.creatUser = creatUser;
    this.creatTime = creatTime;
    this.modifiedUser = modifiedUser;
    this.modifiedTime = modifiedTime;
  }

  public String getCreatUser() {
    return creatUser;
  }

  public void setCreatUser(String creatUser) {
    this.creatUser = creatUser;
  }

  public Date getCreatTime() {
    return creatTime;
  }

  public void setCreatTime(Date creatTime) {
    this.creatTime = creatTime;
  }

  public String getModifiedUser() {
    return modifiedUser;
  }

  public void setModifiedUser(String modifiedUser) {
    this.modifiedUser = modifiedUser;
  }

  public Date getModifiedTime() {
    return modifiedTime;
  }

  public void setModifiedTime(Date modifiedTime) {
    this.modifiedTime = modifiedTime;
  }
}
